<template>
  <div>
    <el-table
      :data="tableData"
      stripe
      @selection-change="handleSelectionChange"
      style="width: 100%;display:block;"
    >
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column label="姓名">
        <template slot-scope="scope">
          <div
            @click="checkuserinfo(scope.row)"
            style="color:#26a2ff;cursor:pointer"
          >{{scope.row.hash.username}}</div>
        </template>
      </el-table-column>
      <el-table-column prop label="人员编号">
        <template slot-scope="scope" width="160">
          <div>{{scope.row.hash.userid}}</div>
        </template>
      </el-table-column>
      <el-table-column prop="hash.sex" label="性别"></el-table-column>
      <el-table-column prop="hash.age" label="年龄"></el-table-column>
      <el-table-column width="150" prop="hash.birthdate" label="出生日期"></el-table-column>
      <el-table-column prop width="200" label="身份证号">
        <template slot-scope="scope" width="100">
          <div>{{scope.row.hash.idnumber}}</div>
        </template>
      </el-table-column>
      <el-table-column prop="hash.appearance" label="政治面貌"></el-table-column>
      <el-table-column prop="hash.tec_title" label="技术职称" width="150"></el-table-column>

      <el-table-column prop="hash.first_education" label="先学历"></el-table-column>
      <el-table-column prop="hash.first_gradutetime" label="毕业时间" width="150"></el-table-column>
      <el-table-column prop="hash.first_school" label="毕业院校" width="200"></el-table-column>
      <el-table-column prop="hash.first_major" label="先学历专业" width="200"></el-table-column>
      <el-table-column prop="hash.last_education" label="后学历"></el-table-column>
      <el-table-column prop="hash.last_gradutetime" label="毕业时间" width="150"></el-table-column>
      <el-table-column prop="hash.last_school" label="毕业院校" width="200"></el-table-column>
      <el-table-column prop="hash.last_major" label="后学历专业" width="200"></el-table-column>
      <el-table-column prop="hash.entry_time" label="入职时间" width="150"></el-table-column>

      <el-table-column prop="hash.dept" label="所在部门" width="150"></el-table-column>

      <el-table-column prop="hash.positional" label="职务"></el-table-column>
      <el-table-column prop="hash.occupation" label="岗位" width="150"></el-table-column>
      <el-table-column prop="hash.usertype" label="人员状态"></el-table-column>
      <!-- <el-table-column label="身份证">
        <template slot-scope="scope">
          <div v-if="scope.row.hash.idcardpic==''">
            无附件
          </div>
          <div v-else>
            <a @click="checkpic(scope.row.hash.idcardpic)" style="cursor:pointer">
              预览
            </a>
            <a :href="scope.row.hash.idcardpic" target="_blank" download="">下载</a>
          </div>

        </template>
      </el-table-column>-->
    </el-table>
    <el-pagination
      @current-change="handleCurrentChange"
      :currentPage.sync="pagobj.currentPage3"
      :pageSize="pagobj.pagesize"
      layout="total, prev, pager, next"
      :total="pagobj.total"
      style="margin:20px 0;text-align:center"
    ></el-pagination>
    <el-dialog :visible.sync="dialogVisible">
      <img width="100%" :src="dialogImageUrl" alt />
    </el-dialog>
    <checkperson v-if="ischeckperson" :editdata="editdata" :isedit="true"></checkperson>
  </div>
</template>

<script>
import checkperson from "~/components/person/manager/checkperson.vue";

export default {
  data() {
    return {
      ts: this.newStore(),
      dialogVisible: false,
      dialogImageUrl: "",
      ischeckperson: false,
      editdata: {}
    };
  },
  components: {
    checkperson
  },
  props: {
    tableData: {
      type: Array,
      required: true
    },
    pagobj: {
      type: Object,
      required: true
    },
    choosedp: Array
  },
  methods: {
    handleCurrentChange() {
      this.$parent.getpersonlist();
    },
    checkpic(picurl) {
      this.dialogImageUrl = picurl;
      this.dialogVisible = true;
    },
    handleSelectionChange(val) {
      this.$emit("update:choosedp", val);
    },
    checkuserinfo(item) {
      console.log(item);

      const req = {
        handle:
          "33224548EFC2E94F97536D55316F44F2A06ED94DCB3C4375FD58B6E268D37EF8",
        pid: item.hash.pid
      };
      this.spost(this.ts, "/mainservlet", req).then(ts => {
        this.editdata = ts.d.data.operation1[0].hash;
        this.ischeckperson = false;
        this.$nextTick(() => {
          this.ischeckperson = true;
        });
      });
    }
  }
};
</script>

<style>
</style>
